package com.examp.dy.dy.service;

import com.examp.dy.dy.dao.BookRepository;

import com.examp.dy.dy.entities.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class BookService {
    @Autowired
    BookRepository bookRepository;

    public  Book save(Book book){
        return bookRepository.save(book);
    }
    public List<Book> getAll(){
        return  bookRepository.findAll();
    }



    public Book findByBookId(long bookId){
return bookRepository.findByBookId(bookId);
    }
    public void deleteById(Long bookId){
        bookRepository.deleteById(bookId);
    }
  public Book findBookByBookname(String bookname){
        return bookRepository.findBookByBookname(bookname);
  }


}
